﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package com.facebook.utils {
    import flash.utils.*;
    import flash.net.*;

    public class JavascriptRequestHelper {

        public static function objectToString(_arg1:Object):String{
            var _local3:String;
            var _local2:Array = [];
            for (_local3 in _arg1) {
                _local2.push((((_local3 + ": ") + quote(_arg1[_local3])) + ""));
            };
            return ((("{" + _local2.join(", ")) + " }"));
        }
        public static function quote(_arg1:String):String{
            var _local2:RegExp = /[\\"\r\n]/g;
            return ((("\"" + _arg1.replace(_local2, _quote)) + "\""));
        }
        public static function formatParams(_arg1:Array):String{
            var _local5:Object;
            var _local6:String;
            var _local2:Array = [];
            var _local3:uint = _arg1.length;
            var _local4:uint;
            while (_local4 < _local3) {
                _local5 = _arg1[_local4];
                _local6 = getQualifiedClassName(_local5);
                switch (_local6){
                    case "Array":
                        _local5 = (("[" + _local5.join(", ")) + "]");
                        break;
                    case "Object":
                        _local5 = objectToString(_local5);
                        break;
                    case "String":
                    default:
                        _local5 = (("\"" + _local5) + "\"");
                };
                _local2.push(_local5);
                _local4++;
            };
            return (_local2.join(", "));
        }
        protected static function _quote(_arg1:String, ... _args):String{
            switch (_arg1){
                case "\\":
                    return ("\\\\");
                case "\r":
                    return ("\\r");
                case "\n":
                    return ("\\n");
                case "\"":
                    return ("\\\"");
            };
            return (null);
        }
        public static function formatURLVariables(_arg1:URLVariables):String{
            var _local5:String;
            var _local2:Object = {
                method:true,
                sig:true,
                api_key:true,
                call_id:true
            };
            var _local3:Boolean;
            var _local4:Object = {};
            for (_local5 in _arg1) {
                if (_local2[_local5]){
                } else {
                    _local3 = true;
                    _local4[_local5] = _arg1[_local5];
                };
            };
            return ((_local3) ? objectToString(_local4) : "null");
        }

    }
}//package com.facebook.utils 
